<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta content="" name="description" />
    <meta content="webthemez" name="author" />
    <meta http-equiv="pragram" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="0">
    <title>我的选题</title>
    <!-- Bootstrap Styles-->
    <link href="assets/css/bootstrap.css" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="assets/css/font-awesome.css" rel="stylesheet" />

    <link href="assets/css/select2.min.css" rel="stylesheet" >
    <link href="assets/css/checkbox3.min.css" rel="stylesheet" >
    <!-- Custom Styles-->
    <link href="assets/css/custom-styles.css" rel="stylesheet" />
    <!-- Google Fonts-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
</head>
<body>
<div id="page-wrapper" >
    <div class="header">
        <h1 class="page-header">
            我的选题<small><span id="info"></span></small>
        </h1>
    </div>

    <div id="page-inner">


        <div class="row">
            <div class="col-xs-12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <form class="form-horizontal" id="form">
                            <div class="form-group">
                                <label  class="col-sm-2 control-label">课题名称：</label>
                                <div class="col-sm-10">
                                    <label  id="topic" class="control-label"></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-2 control-label">指导老师：</label>
                                <div class="col-sm-10">
                                    <label  id="teacherName" class="control-label"></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-2 control-label">老师电话：</label>
                                <div class="col-sm-10">
                                    <label  id="teacherPhone" class="control-label"></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-2 control-label">课题类别：</label>
                                <div class="col-sm-10">
                                    <label  id="type" class="control-label"></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-2 control-label">课题描述：</label>
                                <div class="col-sm-10">
                                    <label  id="introduction" class="control-label"></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-2 control-label">选题要求：</label>
                                <div class="col-sm-10">
                                    <label  id="requirement" class="control-label"></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-2 control-label">课题来源：</label>
                                <div class="col-sm-10">
                                    <label  id="src" class="control-label"></label>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <input type="button" class="btn btn-default" onclick="cancel()" value="撤销">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>


    </div>
    <!-- /. PAGE INNER  -->
</div>
<!-- /. PAGE WRAPPER  -->
</div>
<!-- /. WRAPPER  -->
<!-- JS Scripts-->
<!-- jQuery Js -->
<script src="assets/js/jquery-1.10.2.js"></script>
<!-- Bootstrap Js -->
<script src="assets/js/bootstrap.min.js"></script>
<!-- Metis Menu Js -->
<script src="assets/js/jquery.metisMenu.js"></script>
<script src="assets/js/select2.full.min.js"></script>
<!-- Custom Js -->
<!--<script src="assets/js/custom-scripts.js"></script>-->
<script src="assets/js/util.js"></script>
<script>
    var user= JSON.parse(sessionStorage.getItem("user"));//将json转换为对象
    var id=user.id;
    var topicid=""
    show();
    function show() {
        var reUser = getResponse('/user/findUser/' + id);
        if (reUser.responseJSON.topicId == null||reUser.responseJSON.topicId=="") {
            document.getElementById("info").innerHTML = "您暂时还未选题";
            document.getElementById("topic").innerHTML="";
            document.getElementById("teacherName").innerHTML="";
            document.getElementById("teacherPhone").innerHTML="";
            document.getElementById("type").innerHTML="";
            document.getElementById("introduction").innerHTML="";
            document.getElementById("requirement").innerHTML="";
            document.getElementById("src").innerHTML="";
        } else {
            topicid=reUser.responseJSON.topicId;
            showtopic(reUser.responseJSON.topicId);
        }
    }
    function showtopic(topicId) {
        var flag=false;
        var re=getResponse('/topic/selectTopic/'+topicId+'?flag='+flag);
        document.getElementById("topic").innerHTML=re.responseJSON.topicName;
        document.getElementById("teacherName").innerHTML=re.responseJSON.teacherName;
        document.getElementById("teacherPhone").innerHTML=re.responseJSON.teacherTel;
        document.getElementById("type").innerHTML=parseType(re.responseJSON.topicType);
        document.getElementById("introduction").innerHTML=re.responseJSON.introduction;
        document.getElementById("requirement").innerHTML=re.responseJSON.requirement;
        document.getElementById("src").innerHTML=parseSrc(re.responseJSON.topicSrc);
    }
    function cancel() {
        getResponse('/topic/cancelChooseTopic/'+topicid+'/'+user.username);
        getResponse('/user/delTopic/'+id);
        show();
    }


</script>


</body>
</html>
